package com.base.cn.platform.os.service.exam.question;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.exam.ExamBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 试题接口Service
 *
 * @author s.li
 * @date 2018/11/30
 */
@FeignClient(name = ExamBaseService.appName,configuration = FeignAuthConfig.class)
public interface ExamQuestionsService  extends ExamBaseService {

    /**
     * 获取试题类型
     * @return
     */
    @RequestMapping(contextPath + "/findQuestionTypeEnumList")
    List<Map<String,String>> findQuestionTypeEnumList(@RequestParam("countData") boolean countData,@RequestParam("isFront") boolean isFront);

    /**
     * 查询试题数量
     * @param condition 查询条件
     * @return 数量
     */
    @RequestMapping(contextPath + "/getQuestionCount")
    BigDecimal getQuestionCount(@RequestBody Map<String, Object> condition);

    /**
     * 修改试题状态
     * @param ids 试题ID串
     * @param status 状态，1发布，2禁用，3删除
     */
    @RequestMapping(contextPath + "/updateExamQuestionStatus")
    Map<String,Object> updateExamQuestionStatus(@RequestParam("ids") String ids,
                                                @RequestParam("status") int status);

    /**
     * 查询试题数据列表
     * @param condition 查询条件对象
     * @param currentPage 页码
     * @param pageSize 查询数量
     * @return PageInfo<ExamQuestion>
     */
    @RequestMapping(contextPath + "/findExamQuestionListPage")
    Map<String,Object> findExamQuestionListPage(@RequestBody Map<String, Object> condition,
                                                @RequestParam(value = "currentPage", required = false, defaultValue = "1") int currentPage,
                                                @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize);

    /**
     * 通过ID，查询试题对象
     * @param condition 查询条件
     * @return 试题对象
     */
    @RequestMapping(contextPath + "/findExamQuestionById")
    Map<String,Object> findExamQuestionById(@RequestBody Map<String, Object> condition);

    /**
     * 能ID串，查询试题Map
     * @param condition 查询条件对象
     * @return  Map<BigDecimal,ExamQuestion>
     */
    @RequestMapping(contextPath + "/findExamQuestionByIds")
    Map<BigDecimal,Map<String,Object>> findExamQuestionByIds(@RequestBody Map<String, Object> condition);

    /**
     * 查询试题列表
     * @param condition 查询条件
     * @return List<ExamQuestion>
     */
    @RequestMapping(contextPath + "/findExamQuestionList")
    List<Map<String,Object>> findExamQuestionList(@RequestBody Map<String, Object> condition);

    /**
     * 查询试题列表，通过类型模板分组试题
     * @param condition 查询条件对象
     * @return Map<BigDecimal,List<ExamQuestion>>
     */
    @RequestMapping(contextPath + "/queryQuestionGroupByQuestionType")
    Map<Integer,List<Map<String,Object>>> queryQuestionGroupByQuestionType(@RequestBody Map<String, Object> condition);

    /**
     * 保存试题
     * @param examQuestion 试题对象
     * @param examId 试卷ID
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/saveExamQuestion")
    Map<String,Object> saveExamQuestion(@RequestBody Map<String, Object> examQuestion,
                                        @RequestParam(value = "examId", required = false, defaultValue = "0") BigDecimal examId);

    /**
     * 获取初始化修改试题内容
     * @param templateId 模板ID
     * @param templateRecordId 模板记录ID
     * @param questionId 试题ID
     * @return Map<String, Object>
     */
    @RequestMapping(contextPath + "/getInitUpdateData")
    Map<String, Object> getInitUpdateData(@RequestParam("templateId") BigDecimal templateId,
                                          @RequestParam(value = "templateRecordId") BigDecimal templateRecordId,
                                          @RequestParam(value = "questionId") BigDecimal questionId);

    /**
     * 查询试题总数量数据
     * @return QuestionSumCount
     */
    @RequestMapping(contextPath + "/queryQuestionSumCount")
    Map<String, Integer> queryQuestionSumCount();
}
